/*************************************************************************
    > File Name: filecode.c
    > Author: ma6174
    > Mail: ma6174@163.com 
    > Created Time: Fri 31 Oct 2025 05:08:57 PM CST
 ************************************************************************/

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int main()
{
	int fd1 = open("log.txt",O_WRONLY | O_CREAT | O_TRUNC, 0666);
	if(fd1 < 0)
	{
		perror("open");
		return 1;
	}
	printf("fd1: %d\n", fd1);

	const char* message = "hello world";
	write(fd1,message,strlen(message));


	close(fd1);
	return 0;
}
